﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Mng_FaultsRecom.aspx.cs" Inherits="admin_Mng_FaultsRecom" %>

<asp:Content ID="Head" ContentPlaceHolderID="head" runat="Server">
    <link href="../styles/admin.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
     <div id="top_menu">
        <div id="help_button">
            help
        </div>
                                <div id="logout">
            <asp:LoginStatus ID="LoginStatus1" runat="server" LogoutPageUrl="../Default.aspx"
                OnLoggingOut="LoginStatus1_LoggingOut" />
        </div>
    </div>
    <div id="page_title">
        ADMINISTRATION
    </div>
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <div id="left_content">
        <div class="menu">
            <ul>
                <li><a href="Home.aspx">Home</a></li>
                <li><a href="Mng_Client.aspx">Manage Clients</a></li>
                <li><a href="Mng_Site.aspx">Manage Sites</a></li>
                <li><a href="Mng_Machine.aspx">Manage Machines</a></li>
                <li><a href=Mng_Comp.aspx >Manage Components</a></li>
                <li><a href="Mng_Report.aspx">Manage Reports</a></li>
                <li><a href="Mng_WO.aspx">Manage Work Order</a></li>
                <li><a href="#" class="current">Manage Faults Recommendation</a></li>
            </ul>
        </div>
    </div>
    <!-- end of left content -->
    <div id="right_content">
        <div class="content_area">
            <h2>
                Manage Components
            </h2>
            <div class="form_box1">
                <%--<asp:FormView ID="FormView1" runat="server">
                <ItemTemplate>
                <h2><%# Eval("FaultsTitle") %>'></h2>
                <h2><%# Eval("FaultsName") %></h2>
                <p><%# Eval("Severity") %></p>
                <%# Eval("Recommendation") %>
                <asp:LinkButton ID="lbEdit" CausesValidation="false" CommandName="Edit" runat="server">Edit</asp:LinkButton>
                <asp:LinkButton ID="lbAddNew" CausesValidation="false" CommandName="New" runat="server">Add New Item</asp:LinkButton>
                <asp:LinkButton ID="lbDelete" CausesValidation="false" CommandName="Delete" runat="server" OnClientClick="return confirm('Are you sure you want to delete this item?');">Delete</asp:LinkButton>
                </ItemTemplate>
                </asp:FormView>--%>
                <table>
                    <tr>
                        <td class="Li_buttonC1">
                            <asp:HyperLink ID="HyperLink1" NavigateUrl="~/admin/Mng_Faults.aspx" runat="server">Manage FaultsConditon</asp:HyperLink>
                        </td>
                        <td class="Li_buttonC1">
                            <asp:HyperLink ID="HyperLink2" NavigateUrl="~/admin/Home.aspx" runat="server">Return Homepage</asp:HyperLink>
                        </td>
                    </tr>
                </table>
                <asp:GridView ID="GridView1"  OnRowEditing="TaskGridView_RowEditing" runat="server" OnRowCreated="TaskGridView_RowCreated"
                    AutoGenerateColumns="False" AllowPaging="True" PageSize="20" OnPageIndexChanging="PageIndexChanging"
                    OnRowCancelingEdit="TaskGridView_RowCancelingEdit" OnRowUpdating="TaskGridView_RowUpdating">
                    <Columns>
                        <asp:BoundField DataField="faultName" HeaderText="FaultType" />
                        <asp:BoundField DataField="faultDes" HeaderText="FaultsCondition" />
                        <asp:TemplateField HeaderText="Severity">
                            <EditItemTemplate>
                                <asp:DropDownList runat="server" ID="severity_dropdownlist" DataValueField='<%#Eval("status_id") %>'>
                                    <asp:ListItem Text="Normal" Value="1"></asp:ListItem>
                                    <asp:ListItem Text="Abnormal" Value="2"></asp:ListItem>
                                    <asp:ListItem Text="Moderate" Value="3"></asp:ListItem>
                                    <asp:ListItem Text="Severe" Value="4"></asp:ListItem>
                                    <asp:ListItem Text="Not Tested" Value="5"></asp:ListItem>
                                </asp:DropDownList>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <%#Eval("Severity") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="recommendation" HeaderText="Recommendation" ApplyFormatInEditMode="True" />
                        <%-- <asp:CheckBoxField DataField="select" HeaderText="Select" />--%>
                        <asp:CommandField ShowEditButton="True"  />
                        <asp:BoundField DataField="recommend_id"/>
                        <asp:BoundField DataField="fault_id" />
                    </Columns>
                    <PagerStyle CssClass="pager" />
                    <HeaderStyle CssClass="header" />
                </asp:GridView>
                <table class="form_box2">
                    <tr>
                        <td>
                            <asp:Label ID="label_faulttitle" runat="server" Text="Select FaultTitle" 
                                CssClass="label1"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
                                DataTextField="faultName" DataValueField="faultName" AutoPostBack="True" CssClass="dropDownList">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Label1" runat="server" Text="Select FaultDescription" 
                                CssClass="label1"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource2"
                                DataTextField="faultDes" DataValueField="fault_id" CssClass="dropDownList">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Label2" runat="server" Text="Severity" CssClass="label1"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="DropDownList3" runat="server" CssClass="dropDownList">
                                <asp:ListItem Value="1">Normal</asp:ListItem>
                                <asp:ListItem Value="2">Abnormal</asp:ListItem>
                                <asp:ListItem Value="2">Moderate</asp:ListItem>
                                <asp:ListItem Value="3">Severe</asp:ListItem>
                                <asp:ListItem Value="5">Not Tested</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Label3" runat="server" Text="Recommendation" CssClass="label1"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="TextBox_recom" runat="server" CssClass="fields1"></asp:TextBox>
                        </td>
                    </tr>
                </table>

                <asp:Button ID="AddButton" runat="server" Text="Add" OnClick="AddButton_Click" CssClass="buttons" />

            </div>
        </div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT [fault_id], [faultName], [faultDes], [faultType] FROM [FaultsCondition] WHERE ([faultType] = @faultType)">
            <SelectParameters>
                <asp:Parameter DefaultValue="1" Name="faultType" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT * FROM [FaultsCondition] WHERE (([faultName] = @faultName) AND ([faultType] = @faultType))">
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" Name="faultName" PropertyName="SelectedValue"
                    Type="String" />
                <asp:Parameter DefaultValue="1" Name="faultType" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT [fault_id], [faultName], [faultDes], [faultType] FROM [FaultsCondition] WHERE ([faultType] = @faultType)">
            <SelectParameters>
                <asp:Parameter DefaultValue="1" Name="faultType" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </div>
    <!-- end of right content -->
</asp:Content>
